package appapi.controller.oider;

import appapi.Global.BusinessException;
import appapi.Request.bigscreen.AlarmStaticReq;
import appapi.Request.bigscreen.MothCheckStaticReq;
import appapi.Request.bigscreen.SelfEquipUseReq;
import appapi.Request.bigscreen.StaticReq;
import appapi.Vo.bigScreen.EquipUseStateVo;
import appapi.Vo.bigScreen.OperatorInfoVo;
import appapi.common.ResponseBean;
import appapi.dto.bigScreenDto.AreaLevelDto;
import appapi.entity.bigscreen.AlarmStaticModel;
import appapi.entity.bigscreen.EquipTypeOverageModel;
import appapi.entity.bigscreen.MothCheckStaticModel;
import appapi.entity.bigscreen.SeltEquipUseStaticModel;
import appapi.service.IBigScreenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author djq
 * @date 2023/5/24 11:28
 * @description:
 */
@Api(tags = "大屏")
@RestController
@RequestMapping(value = "/api/bigScreen")
public class BigScreenController {
    @Resource
    private IBigScreenService iBigScreenService;

    //region 设备使用情况

    /**
     * 设备使用情况(局级)
     *
     * @return
     * @auther djq 2023/5/24
     */
    @ApiOperation(value = "设备使用情况(局级)", notes = "设备使用情况(局级)")
    @GetMapping(value = "/getOrgaUseState")
    public ResponseBean GetOrgaEquipUseState(AreaLevelDto dto) {
        try {

            List<EquipUseStateVo> equipUseStateVos = iBigScreenService.GetOrgaEquipUseState(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备使用情况(项目级)获取异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 设备使用情况(公司)
     *
     * @return
     * @auther djq 2023/5/24
     */
    @ApiOperation(value = "设备使用情况(公司)", notes = "设备使用情况(公司)")
    @GetMapping(value = "/getCompUseState")
    public ResponseBean GetCompEquipUseState(AreaLevelDto dto) {
        try {

            List<EquipUseStateVo> equipUseStateVos = iBigScreenService.GetCompEquipUseState(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备使用情况(公司)获取异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 设备使用情况(项目级)
     *
     * @return
     * @auther djq 2023/5/24
     */
    @ApiOperation(value = "设备使用情况(项目级)", notes = "设备使用情况(项目级)")
    @GetMapping(value = "/getProjUseState")
    public ResponseBean GetProjEquipUseState(AreaLevelDto dto) {
        try {

            List<EquipUseStateVo> equipUseStateVos = iBigScreenService.GetProjEquipUseState(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备使用情况(项目级)获取异常: ".concat(e.getMessage()));
        }
    }
    //endregion

    //region 人员信息
    /**
     * 人员信息(局级)
     *
     * @return
     * @auther djq 2023/6/5
     */
    @ApiOperation(value = "人员信息(局级)", notes = "人员信息(局级)")
    @GetMapping(value = "/getOrgaOperatorInfo")
    public ResponseBean getOrgaOperatorInfo(AreaLevelDto dto) {
        try {

            List<OperatorInfoVo> equipUseStateVos = iBigScreenService.getOrgaOperatorInfo(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("人员信息(局级)异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 人员信息(公司级)
     *
     * @return
     * @auther djq 2023/6/5
     */
    @ApiOperation(value = "人员信息(公司级)", notes = "人员信息(公司级)")
    @GetMapping(value = "/getCompOperatorInfo")
    public ResponseBean getCompOperatorInfo(AreaLevelDto dto) {
        try {

            List<OperatorInfoVo> equipUseStateVos = iBigScreenService.getCompOperatorInfo(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("人员信息(公司级)异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 人员信息(项目级)
     *
     * @return
     * @auther djq 2023/6/5
     */
    @ApiOperation(value = "人员信息(项目级)", notes = "人员信息(项目级)")
    @GetMapping(value = "/getProjOperatorInfo")
    public ResponseBean getProjOperatorInfo(AreaLevelDto dto) {
        try {

            List<OperatorInfoVo> equipUseStateVos = iBigScreenService.getProjOperatorInfo(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("人员信息(项目级)异常: ".concat(e.getMessage()));
        }
    }
    //endregion

    //region 设备类型总数

    /**
     * 设备类型总数(局级)
     *
     * @return
     * @auther djq 2023/6/5
     */
    @ApiOperation(value = "设备类型总数(局级)", notes = "设备类型总数(局级)")
    @GetMapping(value = "/getOrgaEquipNum")
    public ResponseBean GetOrgaEquipNum(AreaLevelDto dto) {
        try {

            List<EquipUseStateVo> equipUseStateVos = iBigScreenService.GetOrgaEquipNum(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备类型总数(项目级)获取异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 设备类型总数(公司)
     *
     * @return
     * @auther djq 2023/6/5
     */
    @ApiOperation(value = "设备类型总数(公司)", notes = "设备类型总数(公司)")
    @GetMapping(value = "/getCompEquipNum")
    public ResponseBean GetCompEquipNum(AreaLevelDto dto) {
        try {

            List<EquipUseStateVo> equipUseStateVos = iBigScreenService.GetCompEquipNum(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备类型总数(公司)获取异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 设备类型总数(项目级)
     *
     * @return
     * @auther djq 2023/6/5
     */
    @ApiOperation(value = "设备类型总数(项目级)", notes = "设备类型总数(项目级)")
    @GetMapping(value = "/getProjEquipNum")
    public ResponseBean GetProjEquipNum(AreaLevelDto dto) {
        try {

            List<EquipUseStateVo> equipUseStateVos = iBigScreenService.GetProjEquipNum(dto);

            return ResponseBean.success(equipUseStateVos);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备类型总数(项目级)获取异常: ".concat(e.getMessage()));
        }
    }
    //endregion


    /**
     * 自有设备使用情况(局级)
     *
     * @return
     * @auther lc 2023/6/05
     */
    @ApiOperation(value = "自有设备使用统计(局级)", notes = "自有设备使用统计(局级)")
    @GetMapping(value = "/getOrgaSelfEquipUseStatic")
    public ResponseBean<SeltEquipUseStaticModel> getOrgaSelfEquipUseStatic(SelfEquipUseReq req) {
        try {
            List<SeltEquipUseStaticModel> modelList = iBigScreenService.GetOrgaSelfEquipUseStatic(req);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("自有设备使用统计: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况(公司级)
     *
     * @return
     * @auther lc 2023/6/05
     */
    @ApiOperation(value = "自有设备使用统计(公司级)", notes = "自有设备使用统计(公司级)")
    @GetMapping(value = "/getCompSelfEquipUseStatic")
    public ResponseBean<SeltEquipUseStaticModel> getCompSelfEquipUseStatic(SelfEquipUseReq req) {
        try {
            List<SeltEquipUseStaticModel> modelList = iBigScreenService.GetCompSelfEquipUseStatic(req);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("统计异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况(项目级)
     *
     * @return
     * @auther lc 2023/6/05
     */
    @ApiOperation(value = "自有设备--使用统计(项目级)", notes = "自有设备--使用统计(项目级)")
    @GetMapping(value = "/getProjSelfEquipUseStatic")
    public ResponseBean<SeltEquipUseStaticModel> getProjSelfEquipUseStatic(SelfEquipUseReq req) {
        try {
            List<SeltEquipUseStaticModel> modelList = iBigScreenService.GetProjSelfEquipUseStatic(req.getOrgaId());
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("统计异常: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况
     *
     * @return
     * @auther lc 2023/6/05
     */
    @ApiOperation(value = "设备月检--统计(局级)", notes = "设备月检--统计(局级)")
    @GetMapping(value = "/getOrgaMothCheckStatic")
    public ResponseBean<MothCheckStaticModel> getOrgaMothCheckStatic(MothCheckStaticReq req) {
        try {
            List<MothCheckStaticModel> modelList = iBigScreenService.GetOrgaMothCheckStatic(req);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备月检统计: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况
     *
     * @return
     * @auther lc 2023/6/05
     */
    @ApiOperation(value = "设备月检--统计(公司级)", notes = "设备月检--统计(公司级)")
    @GetMapping(value = "/getCompMothCheckStatic")
    public ResponseBean<MothCheckStaticModel> getCompMothCheckStatic(MothCheckStaticReq req) {
        try {
            List<MothCheckStaticModel> modelList = iBigScreenService.GetCompMothCheckStatic(req);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备月检统计: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况
     *
     * @return
     * @auther lc 2023/6/05
     */
    @ApiOperation(value = "设备月检--统计(项目级)", notes = "设备月检--统计(项目级)")
    @GetMapping(value = "/getProjMothCheckStatic")
    public ResponseBean<MothCheckStaticModel> getProjMothCheckStatic(Long orgaId) {
        try {
            List<MothCheckStaticModel> modelList = iBigScreenService.GetProjMothCheckStatic(orgaId);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备月检统计: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况
     *
     * @return
     * @auther lc 2023/6/07
     */
    @ApiOperation(value = "设备预警--统计(项目级)", notes = "设备预警--统计(项目级)")
    @GetMapping(value = "/getProjEquipOverageStatic")
    public ResponseBean<EquipTypeOverageModel> getProjEquipOverageStatic(Long orgaId) {
        try {
            List<EquipTypeOverageModel> modelList = iBigScreenService.GetProjEquipOverageStatic(orgaId);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备预警统计: ".concat(e.getMessage()));
        }
    }


    /**
     * 自有设备使用情况
     *
     * @return
     * @auther lc 2023/6/07
     */
    @ApiOperation(value = "设备预警--统计(局级)", notes = "设备预警--统计(局级)")
    @GetMapping(value = "/getOrgaEquipOverageStatic")
    public ResponseBean<EquipTypeOverageModel> getOrgaEquipOverageStatic(StaticReq req) {
        try {
            List<EquipTypeOverageModel> modelList = iBigScreenService.GetOrgaEquipOverageStatic(req);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备预警统计: ".concat(e.getMessage()));
        }
    }

    /**
     * 自有设备使用情况
     *
     * @return
     * @auther lc 2023/6/07
     */
    @ApiOperation(value = "设备预警--统计(公司级)", notes = "设备预警--统计(公司级)")
    @GetMapping(value = "/getCompEquipOverageStatic")
    public ResponseBean<EquipTypeOverageModel> getCompEquipOverageStatic(StaticReq req) {
        try {
            List<EquipTypeOverageModel> modelList = iBigScreenService.GetCompEquipOverageStatic(req);
            return ResponseBean.success(modelList);
        } catch (BusinessException e) {
            return ResponseBean.fail("设备预警统计: ".concat(e.getMessage()));
        }
    }

}
